﻿@{
    ViewBag.Title = "Change Password";
}
<script type="text/javascript" src="../../Scripts/jquery.validate.js"></script>

@using SAD_SiS.Models
@model Account
<h2>
    Thay đổi mật khẩu</h2>

<script type="text/javascript">
    $(document).ready(function(){
$("#changePassForm").validate({

rules: {
    password:{
            required: true,
            minlength: 8,
            maxlength: 20,

        },
        newPasswd1:{
            minlength: 8,
            maxlength: 20,
        },
        newPasswd2:{
            minlength: 8,
            maxlength: 20,
            equalTo: "#newPasswd1"
        }
},
messages: {
    password:{
            required: "Can't be blank.",
            minlength: jQuery.format("You need to use at least {0} characters."),
            maxlength: "Over {0} characters.",
            equalTo: "wrong password."
        },
        newPasswd1:{
            required: "Can't be blank.",
            minlength: jQuery.format("You need to use at least {0} characters."),
            maxlength: "Over {0} characters."
        },
        newPasswd2:{
            required: "Can't be blank.",
            minlength: jQuery.format("You need to use at least {0} characters."),
            maxlength: "Over {0} characters.",
            equalTo: "Enter the same new password"
        }
},

});
});

</script>
<form id="changePassForm" action="@Url.Action("ChangePassword", "Customer")" method="post">
<table style="width: 100%;">
    <tr>
        <td style="width: 170px">
            Tài khoản:
        </td>
        <td>
            @Model.Username
        </td>
    </tr>
    <tr>
        <td>
            Mật khẩu hiện tại:
        </td>
        <td>
            <input type="password" value="" id="password" name="password" maxlength="20" />
            @ViewBag.messafe
        </td>
    </tr>
    <tr>
        <td>
            Mật khẩu mới:
        </td>
        <td>
            <input type="password" value="" id="newPasswd1" name="newPasswd1" maxlength="20" />
        </td>
    </tr>
    <tr>
        <td>
            Nhập lại mật khẩu mới:
        </td>
        <td>
            <input type="password" value="" id="newPasswd2" name="newPasswd2" maxlength="20" />
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <input class="btn btn-primary" id="Submit1" type="submit" value="Xong" />
        </td>
    </tr>
</table>
</form>
